<?php

use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;

?>
<?php

NavBar::begin([
    'brandLabel' => 'QA问答系统管理后台',
    'brandUrl' => Yii::$app->homeUrl . 'admin/default',
    'options' => [
        'class' => 'navbar-inverse navbar-fixed-top',
    ],
]);
echo Nav::widget([
    'options' => ['class' => 'navbar-nav navbar-right'],
    'items' => [
        ['label' => '去首页', 'url' => ['/'], 'linkOptions' => ['target' => '_blank']],
        Yii::$app->user->isGuest ? ['label' => '登录', 'url' => ['/user/login']] : ['label' => '退出登录 (' . Yii::$app->user->identity->username . ')', 'url' => ['/user/logout'], 'linkOptions' => ['data-method' => 'post']],
    ],
]);
NavBar::end();
?>